<template>
    <el-dropdown v-bind="$attrs" v-on="$listeners">
        <slot name="title">
            <span class="el-dropdown-link">
                {{ title }}<i class="el-icon-arrow-down el-icon--right"></i>
            </span>
        </slot>
        <el-dropdown-menu slot="dropdown">
            <el-dropdown-item v-for="item in items" :icon="item.icon" :key="item.method" :command="item.method">
                {{ item.label }}
            </el-dropdown-item>
        </el-dropdown-menu>
    </el-dropdown>
</template>

<script>
export default {
    name: 'DropDown',
    props: {
        title: {
            type: String,
            default: '下拉菜单'
        },
        items: {
            type: Array,
            require: true
        }
    },
    data() {
        return {}
    }
}
</script>
<style scoped></style>